import { TerminalStatus } from "@/pages/home/service"
import request from "@/utils/request"
import { GunStatus } from "../stubList/services"

export interface QueryStationMonitorListParams extends PaginationParams {
  /** 场站名称 */
  stationKeyword?: string
}
export interface StationMonitor {
  id: string
  name: string
  warning: number
  outline: number
  using: number
  charging: number
  free: number
  other: number
}
export async function queryStationMonitorList(params: QueryStationMonitorListParams) {
  return request<StationMonitor[]>('/app/manager/station/watchStationList', {
    data: params,
  })
}

export interface QueryStubMonitorListParams {
  stubGroupId: string
}
export interface StubMonitor {
  id: string
  equipmentId: string
  status: GunStatus
  carPlat: string
  kw: number
  carKw: number
  occupyTime: number
  power: number
  soc: number
  statusCode: string
  statusName: string
  endName: string
  stubName: string
  time: string
  timestamp: number
}
export async function queryStubMonitorList(params: QueryStubMonitorListParams) {
  return request<{list: StubMonitor[], stubNum: TerminalStatus}>('/app/manager/stub/watchStubList', {
    data: params,
  })
}

export async function queryStubCount(params: {stubGroupId: string}) {
  return request<TerminalStatus>('/app/manager/station/stubCount', {
    data: params,
  })
}
